﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentValidation;
using FluentValidation.Results;
using Estoque.Core.Excecoes;

namespace Estoque.Core.Validacoes
{
    public abstract class ValidadorAbstrato<T> : AbstractValidator<T>,IValidador<T> where T :class
    {
        public IList<ValidationFailure> ValideRegras(T Instancia)
        {
            ValidationResult validationResult = this.Validate(Instancia);
            if (!validationResult.IsValid)
                return validationResult.Errors;

            return validationResult.Errors;
        }
    }
}
